[sample] System.arraycopy() 부분복사 :: 자주 쓰이는 메소드및 API 를 정리합니다.[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

자주 쓰이는 메소드및 API 를 정리합니다.
[1]
등록일:2008-03-10 10:49:21 (0%)
작성자:
제목:[sample] System.arraycopy() 부분복사
public  class  ArrayCopyMain  {
    public  static  void  main(  String[]  args  )  {
        int[]  source  =  new  int[]  {  5,  4,  6,  9,  7,  9  };
        int[]  target  =  {  100,  200,  300,  400,  500,  600,  700  };

        //  source의  2번째  첨자부터  4개를  target의  3번째  첨자부터  복사
        System.arraycopy(  source,  2,  target,  3,  4  );
        for  (  int  i  =  0;  i  <  target.length;  i++  )  {
            System.out.println(  "target["  +  i  +  "]:  "  +  target[i]  );
        }
    }
}


//  output
target[0]:  100
target[1]:  200
target[2]:  300
target[3]:  6
target[4]:  9
target[5]:  7
target[6]:  9

하나의  객체만을  가지고  저렇게  쉽게  복사할  수  있다.  (로직한줄도  간과하면  안되요..)

출처  :  http://neouser.tistory.com/32
[본문링크] [sample] System.arraycopy() 부분복사
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=2454
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.